import requests


class IHRMLoginAPI:
    #封装一个登录接口的API
    @classmethod
    def login_api(cls,login_body):
        login_url="http://ihrm2-test.itheima.net/api/sys/login"
        login_header = {"Content-Type": "application/json"}

        login_resp = requests.post(url=login_url, headers=login_header, json=login_body)
        return login_resp

    #封装图片验证码
    @classmethod
    def get_image_code(cls,session):
        session.get("http://hmshop-test.itheima.net/index.php?m=Home&c=User&a=verify")
    #封装tpshop登录接口
    @classmethod
    def tpshop_login_api(cls,session,body):
        url = 'http://hmshop-test.itheima.net/index.php?m=Home&c=User&a=do_login'
        header = {"Content-Type": "application/x-www-form-urlencoded"}
        resp = session.post(url=url, headers=header, data=body)
        return resp


    pass